package com.example.mypotiota_si.Activity;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.mypotiota_si.Adapter.ListViewAdapter_dz;
import com.example.mypotiota_si.R;

public class WoDe_DiZhiActivity extends AppCompatActivity {
        private ImageView dz_fh;
        private TextView dz_tj;
        private Button dj_edit;
        RecyclerView dz_recycler;
        ListViewAdapter_dz dz_adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wo_de_di_zhi);
        //隐藏标题栏
        ActionBar actionBar=getSupportActionBar();
        if (actionBar!=null){
            actionBar.hide();
        }
        //找到控件
        dz_fh=findViewById(R.id.dz_fh);
        dz_tj=findViewById(R.id.dz_tj);
        dz_recycler=findViewById(R.id.dz_recycler_view);
        dj_edit=findViewById(R.id.dz_edit);
        //布局
        LinearLayoutManager layoutManager=new LinearLayoutManager(this);
        layoutManager.setOrientation(RecyclerView.VERTICAL);
        dz_recycler.setLayoutManager(layoutManager);
        dz_adapter=new ListViewAdapter_dz();
        dz_recycler.setAdapter(dz_adapter);

        //点击事件
        init_dj();
    }
    //点击事件
    private void init_dj() {
        //点击返回
        dz_fh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        //点击添加
        dz_tj.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(WoDe_DiZhiActivity.this,DiZhi_TianJiaActivity.class);
                startActivity(intent);
            }
        });
        //点击编辑
//        dj_edit.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Intent intent=new Intent(WoDe_DiZhiActivity.this,DiZhi_BianJiActivity.class);
//                startActivity(intent);
//            }
//        });
    }
}
